package cn.mst.vrs.controller.app.auth;

import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.mst.vrs.controller.app.auth.vo.VrsUserLoginReqVO;
import cn.mst.vrs.controller.app.auth.vo.VrsUserRegisterReqVO;
import cn.mst.vrs.service.auth.AuthService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;

@Tag(name = "WX - 认证模块", description = "认证模块")
@RestController
@RequestMapping("/vrs/auth")
public class AuthAppController {
    @Resource
    private AuthService authService;

    @PostMapping("/register")
    @Operation(summary = "用户注册")
    public CommonResult<Boolean> register(@RequestBody @Valid VrsUserRegisterReqVO reqVO) {
        authService.registerVrs(reqVO);
        return success(true);
    }

    @PostMapping("/login")
    @Operation(summary = "用户登录")
    public CommonResult<String> login(@RequestBody @Valid VrsUserLoginReqVO reqVO) {
        return success(authService.loginVrs(reqVO));
    }
}
